package com.woniuxy.config;

import com.woniuxy.interceptor.BloomFilterInterceptor;
import com.woniuxy.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @BelongsProject: pigTrotterStore
 * @BelongsPackage: com.woniuxy.config
 * @Author: Quan
 * @Date: 2025/3/11 18:59
 */
@Configuration
public class WebMVCConfig implements WebMvcConfigurer {
	@Resource
	private LoginInterceptor loginInterceptor;

	@Resource
	private BloomFilterInterceptor bloomFilterInterceptor;
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(loginInterceptor)
				.addPathPatterns("/**")  // 添加拦截规则
				.excludePathPatterns("/user/login", "/food/queryAll")
				.order(1);
		registry.addInterceptor(bloomFilterInterceptor)
				.addPathPatterns("/food/queryFoodDetail/**")  // 添加拦截规则
				.order(2);
	}
}
